import Vue from "vue";
import Vuex from "vuex";
Vue.use(Vuex);
import { $_commit_model } from "../utils/main";
// console.log( createPersistedState )

//挂在vuex原型
/**
 * @description: 
 * @param {Object} modelInfo // 载入对象
 * @param {String} modelConfig // 模块路径
 * @return {void}
 */
Vuex.Store.prototype.$_commit = function(modelInfo , modelConfig){
  this.commit("$_commit_model",{
    modelInfo
    ,modelConfig
  });
}

export default new Vuex.Store({
  // 状态持久化插件

  state: {
    name:"wh"
    ,age:26
    ,list:{
      type:1
      ,child:["cat","dog","finsh"]
    }
    ,language:"zh-CN"
    ,languageList:["zh-CN","en-US"]
  },
  mutations: {
    $_commit_model
  },
  // actions: {},
  // modules: {
  //   "a":{
  //     state:{
  //       name:"yjh"
  //     }
  //   }

  // }
});
